package com.qs.sckill.dao;

import com.qs.sckill.entity.SckillGoods;
import com.qs.sckill.vo.GoodsVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GoodsDao {

    @Select("select g.*,sg.stock_count,sg.start_date,sg.end_date,sg.sckill_price " +
            "from t_sckill_goods sg " +
            "left join t_goods g on sg.goods_id=g.id ")
    List<GoodsVo> listGoodsVo();

    @Select("select stock_count from t_sckill_goods where goods_id=#{goodsId}")
    @ResultType(Integer.class)
    Integer getStockCount(@Param("goodsId") String goodsId);

    @Select("select g.*,sg.stock_count,sg.start_date,sg.end_date,sg.sckill_price " +
            "from t_sckill_goods sg " +
            "left join t_goods g on sg.goods_id=g.id " +
            "where sg.goods_id=#{goodsId}")
    GoodsVo getGoodsVoByGoodsId(@Param("goodsId") String goodsId);
}
